package sky.demo.persistence.dao;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import sky.demo.persistence.entity.User;

/**
 * @author sky
 */
public interface UserDao extends BaseRepository<User> {

    User findByAccount(String account);

    List<User> findByName(String name);

    @Query("from User where name like :name ")
    List<User> findByLikeName(@Param("name") String name);

    @Query("from User u where u.name like :name ")
    Page<User> findByLikeName(@Param("name") String name, Pageable pageable);

    User findByAccountAndPwd(String account, String pwd);

    @Query("from User where name in (:names) ")
    List<User> findByNames(@Param("names") List<String> names);

}
